package com;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;

/**
 * 缓冲流,构造方法传入的不是文件路径,而是文件流对象
 * 
 * String readLine () : 读取一行数据,返回读取到的文件内容,到达文件末尾返回 null
 * 
 * @author lenovo
 *
 */
public class IO_10_BufferedReader_01 {

	public static void main(String[] args) {
		try (FileReader fr = new FileReader("./src/ip.txt");
				BufferedReader br = new BufferedReader(fr);) {
			// String tmp = null;
			// while ((tmp = br.readLine()) != null) {
			// System.out.println(tmp);
			// }
			char[] chars = new char[1024 * 1024 * 30 / 2];
			int tmp = 0;

			long startTime = System.currentTimeMillis();
			br.read(chars);
			long endTime = System.currentTimeMillis();
			System.out.println(endTime - startTime);
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			FileInputStream fis = new FileInputStream("xxx");
			BufferedInputStream bis = new BufferedInputStream(fis);

			FileOutputStream fos = new FileOutputStream("xxx");
			BufferedOutputStream bos = new BufferedOutputStream(fos);

			FileWriter fw = new FileWriter("xxxx");
			BufferedWriter bw = new BufferedWriter(fw);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
